package vn.com.vega.music.view.adapter;

import java.util.List;

import vn.com.vega.chacha.v2.fragment.NewsDetailFragment;
import vn.com.vega.music.objects.NewsEntry;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class NewsViewAdapter extends FragmentPagerAdapter {
	private List<Object> mListNews;

	public NewsViewAdapter(FragmentManager fm , List<Object> listNews) {
		super(fm);
		mListNews = listNews;
	}

	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		NewsDetailFragment f = NewsDetailFragment.newInstance();
		NewsEntry news = (NewsEntry)mListNews.get(arg0);
		f.newsUrl = news.wapUrl;
		return f;
		
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if (mListNews != null) {
			return mListNews.size();
		} else {
			return 0;
		}
	}

}
